Skip to content

Conversation

@StellaHuang95
Copy link
Contributor

fixes #1124

The changes made in #1120 introduced logic to avoid writing unnecessary settings when the selected environment manager is the implicit default (system manager). This was intended to prevent polluting settings.json.

However, this optimization broke manual interpreter selection. When a user clicks the status bar and explicitly selects a global/system interpreter in a workspace with an empty settings.json, the selection is silently ignored because the code determines "this is the default, so don't write it."

This PR added an optional forceWrite flag to EditAllManagerSettings, EditEnvManagerSettings, and EditPackageManagerSettings interfaces and updated all user-initiated callers in envManagers.ts and envCommands.ts to pass forceWrite: true.

image

@StellaHuang95 StellaHuang95 added the bug Issue identified by VS Code Team member as probable bug label Jan 30, 2026
@eleanorjboyd
Copy link
Member

thinking on this and the edge cases here- thanks for the PR

@StellaHuang95
Copy link
Contributor Author

thinking on this and the edge cases here- thanks for the PR

Thanks. Looking back at the original bug, the user reported that python-envs.defaultEnvManager: "ms-python.python:system" and python-envs.pythonProjects: [] were added to settings.json unexpectedly.

It seems reasonable to me that python-envs.defaultEnvManager gets added when an interpreter is selected for the workspace, based on the logic in settingHelper.ts. Would it make sense to check with Karthik whether this behavior is intentional? But I do agree that the logic around python-envs.pythonProjects could be improved so that the setting isn’t written when the value is empty.

@eleanorjboyd
Copy link
Member

ended up doing a larger overhaul since this needed area in general needed some work. Incorporated your PR improvements into here: #1155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: interpreter selection status bar not working when switching environments

2 participants